from typing import Dict

from state.block import WorldBlock
from state.player import Player
from state.functions import initial_world, initial_player


class GameState:
    def __init__(self, ws=10):
        self.pause = True
        self.tick = 0
        self.filter = 0  # 探索滤镜

        self.players: Dict[str, Player] = dict()
        self.obverse: str | None = None

        self.word_size = ws
        self.world_block_map: Dict[(int, int), WorldBlock] = initial_world(ws)

        self.init_state()

    def init_state(self):
        player = initial_player(self.world_block_map, 'aaa')
        self.players[player.name] = player
        self.obverse = player.name
